Skip to content

Conversation

@kzu
Copy link
Member

@kzu kzu commented Feb 11, 2023

We currently surface the PackageReference's IncludeAssets/ExcludeAssets as the ultimate dependency Include/Exclude metadata attributes. This is not always what you want, though.

For example: if you need the compile dependency for compiling the project, but only want to surface the dependency as a build dependency, you cannot exclude the compile asset because your project depends on the lib to build.

In order to make this more intuitive and aligned with the other attributes, we introduce PackInclude/PackExclude attributes for that purpose, which map exactly to the .nuspec: https://learn.microsoft.com/en-us/nuget/reference/nuspec#dependencies-element.

Note that the existing behavior will be overriden if those attributes are provided, which provides backwards compatibility.

@kzu kzu added the enhancement New feature or request label Feb 11, 2023
@kzu kzu force-pushed the dev/include-exclude branch from a5ed5e6 to 46f54dd Compare February 11, 2023 03:57
@kzu kzu enabled auto-merge (rebase) February 11, 2023 03:57
We currently surface the PackageReference's IncludeAssets/ExcludeAssets as the ultimate dependency Include/Exclude metadata attributes. This is not always what you want, though.

For example: if you need the compile dependency for compiling the project, but only want to surface the dependency as a build dependency, you cannot exclude the compile asset because your project depends on the lib to build.

In order to make this more intuitive and aligned with the other attributes, we introduce PackInclude/PackExclude attributes for that purpose, which map exactly to the .nuspec: https://learn.microsoft.com/en-us/nuget/reference/nuspec#dependencies-element.

Note that the existing behavior will be overriden if those attributes are provided, which provides backwards compatibility.
@kzu kzu force-pushed the dev/include-exclude branch from 46f54dd to 922d418 Compare February 11, 2023 04:12
@kzu kzu merged commit 5fa3998 into main Feb 11, 2023
@kzu kzu deleted the dev/include-exclude branch February 11, 2023 04:22
@devlooped devlooped locked and limited conversation to collaborators Nov 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants